# 作者: YYJ
# 2025年07月13日14时53分09秒
# 2486249622@qq.com
from greenlet import greenlet
import time

def test1():
    while True:
        print("---1---")
        g2.switch()
        time.sleep(0.5)

def test2():
    while True:
        print("---2---")
        g1.switch()
        time.sleep(0.5)

g1 = greenlet(test1)
g2 = greenlet(test2)

g1.switch()